﻿@model SelfMadeMillionaire.Web.Infrastructure.ViewModels.Newsletters.NewsletterEditViewModel
@using SelfMadeMillionaire.Web.Infrastructure



<div class="row">
	<div class="col-sm-10">
		<div class="form-group">
			@Html.LabelFor(model => model.MinAccessLevel, new { @class = "col-sm-4 control-label" })
			<div class="col-sm-8">
				@Html.DropDownListFor(m => m.MinAccessLevel, Model.AccessLevels, new { @class = "form-control" })
			</div>
		</div>
		<div class="form-group">
			@Html.LabelFor(model => model.Letter, new { @class = "col-sm-4 control-label" })
			<div class="col-sm-8">
				@Html.DropDownListFor(m => m.Letter, Model.ProductTypes, new { @class = "form-control" })
				@Html.ValidationMessageFor(model => model.Letter)
			</div>
		</div>
		<div class="form-group">
			@Html.LabelFor(model => model.IssueType, new { @class = "col-sm-4 control-label" })
			<div class="col-sm-8">
				@Html.DropDownListFor(m => m.IssueType, Model.IssueTypes, new { @class = "form-control" })
				@Html.ValidationMessageFor(model => model.IssueType)
			</div>
		</div>
		<div class="form-group">
			@Html.LabelFor(model => model.Symbols, new { @class = "col-sm-4 control-label" })
			<div class="col-sm-8">
				@Html.TextBoxFor(model => model.Symbols, new { @class = "form-control" })
				@Html.ValidationMessageFor(model => model.Symbols)
			</div>
		</div>
		<div class="form-group">
			@Html.LabelFor(model => model.Date, new { @class = "col-sm-4 control-label" })
			<div class="col-sm-8">
				@Html.TextBoxFor(model => model.Date, "{0:" + Constants.DATE_FORMAT + "}", new { @class = "form-control" })
				@Html.ValidationMessageFor(model => model.Date)
			</div>
		</div>
		<div class="form-group">
			@Html.LabelFor(model => model.Title, new { @class = "col-sm-4 control-label" })
			<div class="col-sm-8">
				@Html.TextBoxFor(model => model.Title, new { @class = "form-control" })
				@Html.ValidationMessageFor(model => model.Title)
			</div>
		</div>
		<div class="form-group">
			@Html.LabelFor(model => model.PdfFile, new { @class = "col-sm-4 control-label" })
			<div class="col-sm-8">
				@Html.HiddenFor(m => m.PdfFileName)
                @if(!string.IsNullOrEmpty(Model.PdfFileName))
                {
                    <div style="padding-bottom:5px;">
                        @Html.TextBoxFor(model => model.PdfFileName, new { @class = "form-control", disabled = "disabled" })
                    </div>
                }
				<input type="file" id="@Html.IdFor(m => m.PdfFile)" name="@Html.NameFor(m => m.PdfFile)" />
				@Html.ValidationMessageFor(model => model.PdfFile)
			</div>
		</div>
        <div class="form-group">
            <label class = "col-sm-4 control-label">Portfolios</label>
            <div class="col-sm-8">
            @for (int i = 1; i < Model.ProductTypes.Count(); ++i )
            {
                var item = Model.ProductTypes.ElementAt(i);
                <div class="col-sm-12">
		        <div class="form-group">
			        <label class="col-sm-12 control-label" style="text-align:left;">
				        @item.Text
                        <input type="checkbox" name="SelectedProducts" value="@item.Value" id="@item.Value" @{if (Model.SelectedProducts.Contains(Convert.ToInt32(item.Value)))
                                                                                                              { <text> checked='checked' </text>  } } />
			        </label>
		        </div>
	            </div>
                }
            </div>
        </div>

	</div>
</div>



<script type="text/javascript">

	$(function () {
		$("#@Html.IdFor(m => m.Date)").datepicker();
	});

</script>
